<{extends file='layout_uc.html'}>
<{block name='body'}>
	<div class="uc_title m_10">
		<label class="current"><span>个人资料</span></label>
	</div>

	<div class="form_content m_10">
		<div class="uc_title2 m_10"><strong>会员信息</strong></div>
		<dl class="userinfo_box clearfix">
			<dt>
								<a class="ico" href="javascript:void(0);"><img src="/" id="user_ico_img" onerror="this.src='<{$SKIN_FOLDER}>Css/user_ico.gif'" width="96" height="96" alt="个人头像" /></a>
				<a class="blue" href="javascript:select_ico();">修改头像</a>
			</dt>
			<dd>
				<table class="form_table" width="100%" cellpadding="0" cellspacing="0">
					<col width="120px" />
					<col />
					<tr>
						<th>登录名：</th><td>sutroon</td>
					</tr>
					<tr>
						<th>邮箱：</th>
						<td>
							sutroon@qq.com						</td>
					</tr>
					<tr>
						<th>会员等级：</th><td></td>
					</tr>
				</table>
			</dd>
		</dl>
	</div>

	<div class="form_content m_10">
		<div class="uc_title2 m_10"><strong>个人信息</strong></div>
		<form action='/index.php?controller=ucenter&action=info_edit_act' method='post' name='user_info'>
			<table class="form_table" width="100%" cellpadding="0" cellspacing="0">
				<col width="120px" />
				<col />
				<tr>
					<th><span class="red">*</span> 姓名：</th><td><input class="normal" type="text" name="true_name" pattern='required' alt='请填写真实姓名' /></td>
				</tr>
				<tr>
					<th><span class="red">*</span> 性别：</th>
					<td>
						<label class='attr'><input type='radio' name='sex' value='1' />男</label>
						<label class='attr'><input type='radio' name='sex' value='2' checked=checked />女</label>
					</td>
				</tr>
				<tr>
					<th><span class="red">*</span>出生日期：</th>
					<td>
						<select name='year' pattern='required'></select>
						<select name='month' pattern='required'></select>
						<select name='day' pattern='required'></select>
					</td>
				</tr>
				<tr>
					<th><span class="red">*</span> 所在地区：</th>
					<td>
						<select id='province' name="province" onchange="select_city(this.value,2);">
							<option value="">请选择省份</option>
							<option value="1" >﻿北京</option><option value="21" >上海</option><option value="42" >天津</option><option value="62" >重庆</option><option value="104" >安徽</option><option value="227" >福建</option><option value="322" >甘肃</option><option value="423" >广东</option><option value="566" >广西</option><option value="690" >贵州</option><option value="788" >海南</option><option value="814" >河北</option><option value="998" >河南</option><option value="1176" >黑龙江</option><option value="1320" >湖北</option><option value="1436" >湖南</option><option value="1573" >吉林</option><option value="1643" >江苏</option><option value="1763" >江西</option><option value="1874" >辽宁</option><option value="1989" >内蒙古</option><option value="2103" >宁夏</option><option value="2130" >青海</option><option value="2182" >山东</option><option value="2340" >山西</option><option value="2471" >陕西</option><option value="2589" >四川</option><option value="2792" >西藏</option><option value="2873" >新疆</option><option value="2987" >云南</option><option value="3133" >浙江</option><option value="3235" >香港</option><option value="3239" >澳门</option><option value="3242" >台湾</option>						</select>
						<span id="selec2"></span>
						<span id="selec3"></span>
					</td>
				</tr>
				<tr>
					<th><span class="red">*</span> 联系地址：</th>
					<td><input type='text' class='normal' name='contact_addr' pattern='required' alt='请填写联系地址' /></td>
				</tr>
				<tr>
					<th><span class="red">*</span> 邮编：</th>
					<td><input type='text' class='normal' name='zip' pattern='zip' alt='请填写正确的邮政编码' /></td>
				</tr>
				<tr>
					<th><span class="red">*</span> 手机号码：</th>
					<td><input class="normal" type="text" name='mobile' pattern='mobi' alt='请填写正确的手机号码' /></td>
				</tr>
				<tr>
					<th>固定电话：</th>
					<td><input class="normal" type="text" name='telephone' pattern='phone' empty alt='请填写正确的固定电话' /></td>
				</tr>
				<tr>
					<th>QQ：</th>
					<td><input class="normal" type="text" name='qq' pattern='qq' empty alt='请填写正确的QQ号' /></td>
				</tr>
				<tr>
					<th>MSN：</th>
					<td><input class="normal" type="text" name='msn' pattern='email' empty alt='请填写正确的MSN号' /></td>
				</tr>
				<tr><th></th><td><label class="btn"><input type="submit" value="保存基本信息" /></label></td></tr>
			</table>
		</form>
	</div>
<script type='text/javascript'>
	//修改头像
	function select_ico()
	{
				art.dialog.open('/index.php?controller=block&action=photo_upload&callback=%2Findex.php%3Fcontroller%3Ducenter%26action%3Duser_ico_upload',{id:'user_ico',title:'设置头像'});
	}

	//头像上传回调函数
	function callback_user_ico(content)
	{
		var content = eval(content);
		if(content.isError == true)
		{
			alert(content.message);
		}
		else
		{
			$('#user_ico_img').attr('src',content.data);
		}
		art.dialog({id:'user_ico'}).close();
	}

	//出生日期
	function dateSelectInit()
	{
		var yearHtml = '<option value="">请选择</option>';
		for(var year=2010;year>=1940;year--)
		{
			yearHtml+= '<option value="'+year+'">'+year+'</option>';
		}

		var monthHtml = '<option value="">--</option>';
		for(var month=12;month>=1;month--)
		{
			if(month < 10) month = '0' + month;
			monthHtml+= '<option value="'+month+'">'+month+'</option>';
		}

		var dayHtml = '<option value="">--</option>';
		for(var day=31;day>=1;day--)
		{
			if(day < 10) day = '0' + day;
			dayHtml+= '<option value="'+day+'">'+day+'</option>';
		}

		$('[name="year"]').html(yearHtml);
		$('[name="month"]').html(monthHtml);
		$('[name="day"]').html(dayHtml);
	}

	//初始化日期
	dateSelectInit();

	//城市地区
	function select_city(city,style,current)
	{
		var arr = city.split(',');
		$.getJSON("/index.php?controller=block&action=area_child",{aid:arr[0]}, function(json)
		{
			if(style==2)
			{
				var select_html = '<select name="city" id="city" onchange="select_city(this.value,3);">';
				select_html += '<option value="">请选择城市</option>';
				for( a in json)
				{
					if(current == json[a]['area_id'])
						select_html +='<option value="'+json[a]['area_id']+'" selected="selected">'+json[a]['area_name']+'</option>';
					else
						select_html +='<option value="'+json[a]['area_id']+'">'+json[a]['area_name']+'</option>';
				}
				select_html +='</select>';
				$("#selec"+style).html(select_html);
			}
			if(style==3)
			{
				if(json.length>0)
				{
					var select_html = '<select name="area" id="area" onchange="select_city(this.value,4);">';
					select_html += '<option value="">请选择地区</option>';
					for( a in json)
					{
						if(current == json[a]['area_id'])
							select_html +='<option value="'+json[a]['area_id']+'" selected="selected">'+json[a]['area_name']+'</option>';
						else
							select_html +='<option value="'+json[a]['area_id']+'">'+json[a]['area_name']+'</option>';
					}
					select_html +='</select>';
					$("#selec"+style).show();
					$("#selec"+style).html(select_html);
				}
				else
				{
					//if($("#selec"+style).text()=='')
						$("#selec"+style).hide();
				}
			}
		});
	}

	//表单回填
		
	var formObj = new Form('user_info');
	formObj.init({
		'id':'',
		'true_name':'',
		'telephone':'',
		'mobile':'',
		'contact_addr':'',
		'qq':'',
		'msn':'',
		'sex':'1',
		'zip':'',
		'year':'',
		'month':'',
		'day':'',
		'province':''
	});

	select_city('',2,'');
	select_city('',3,'');
</script>
<{/block}>